<%-- 
    Document   : manh
    Created on : May 22, 2012, 11:48:32 PM
    Author     : home
--%>

<%@page import="aptech.data.TypeOfActivityBO"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="java.util.Iterator"%>
<%@page import="java.util.Set"%>
<%@page import="java.util.List"%>
<%@page import="aptech.entities.Activity"%>
<%@page import="java.util.HashMap"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
         <h1> I have been invoked by</h1>
        <table border="1" cellpadding="20">
            <tr>
                <th>Take place on date</th>
                <th>Title</th>
                <th>Topic</th>
                <th>Time Duration</th>
                <th>Location - Slot</th>
                <th>Current student</th>
                <th>Status</th>
            </tr>
        <%
                    //out.print(request.getAttribute("listactivity").toString());
                    HashMap<String, List<Activity>> map = (HashMap<String, List<Activity>>) request.getAttribute("listactivity");
                    Set<String> keys = map.keySet();
                    for (Iterator i = keys.iterator(); i.hasNext();) {
                        String key = (String) i.next();
                        List<Activity> listvalue = map.get(key);
                        for (int j= 0; j < listvalue.size(); j++) {
                            if(j==0){ %>
                                <tr>
                                    <td rowspan=<%=listvalue.size()%>><%=key%>  </td>
                                    <td ><%=listvalue.get(j).getTitleActivity() %>  </td>
                                    <td ><%=listvalue.get(j).getTypeOfActivity().getTypeActivityName() %>  </td>
                                    <td ><%=listvalue.get(j).getTimeDuaration() %>  </td>
                                    <td ><%=listvalue.get(j).getLocaltion() %>  </td>
                                    <td ><%=listvalue.get(j).getCurrentPeople() %>  </td>
                                    <td ><%=listvalue.get(j).getStatusOfActivity() %>  </td>
                                </tr>
                        <%
                            }else{
                                %>
                                <tr>
                                    <td ><%=listvalue.get(j).getTitleActivity()%>  </td>
                                    <td ><%=listvalue.get(j).getTypeOfActivity().getTypeActivityName() %>  </td>
                                    <td ><%=listvalue.get(j).getTimeDuaration() %>  </td>
                                    <td ><%=listvalue.get(j).getLocaltion() %>  </td>
                                    <td ><%=listvalue.get(j).getCurrentPeople() %>  </td>
                                    <td ><%=listvalue.get(j).getStatusOfActivity() %>  </td>
                                </tr>
                                <%
                            }
                        }
                    }
        %>
            
        </table>
    </body>
</html>
